<?php
    include_once 'Zend/Currency.php';
?>
<h2><?= $this->translate('Orders List') ?></h2>
<?php
    $currency = new Zend_Currency('cs_CZ');
?>

<?php if (count($this->orders)>0) { ?>
    <table>
        <tr>
            <th><?= $this->translate('Number') ?></th>
            <th><?= $this->translate('Date Created') ?></th>
            <th><?= $this->translate('Price') ?></th>
            <th><?= $this->translate('Status') ?></th>            
            <th></th>
        </tr>
        <?php foreach( $this->orders as $order ) { ?>
            <tr>
                <td><?= $order['id'] ?></td>
                <?php
                    $timeCreated = explode('-',substr($order['timecreated'],0,10));
                ?>
                <td><?= $timeCreated[2] . '.' . $timeCreated[1] . '. ' . $timeCreated[0] ?></td>
                <td><?= $currency->toCurrency($order['price']) ?></td>
                <td><?= $this->status->translate($order['status']) ?></td>
                <td><a href="<?= $this->url(array('action' => 'order-detail', 'controller' => 'orders', 'id' => $order['id'])) ?>" title="<?= $this->translate('Detail of order number') . ' ' . $order['id'] ?>"><?= $this->translate('Detail') ?></a></td>
            </tr>
        <?php } ?>
    </table>
<?php } else { ?>
    <p><?= $this->translate('No orders yet') ?></p>
<?php } ?>